<%@ page import="java.util.HashSet" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@include file="commons/head.jsp"%>
    <link rel="stylesheet" type="text/css" href="${domainStaticUrl}/css/style.css" />
<div id="wrap">
    <div class="header">
        <div class="logo"><a href="/"><img src="${domainStaticUrl}/images/logo.gif" alt="" title="" border="0" /></a></div>
        <div id="menu">
            <ul>
                <li class="selected"><a href="${domainUrl}/index.jsp">主页</a></li>

                <li><a href="${domainUrl}/book/books">书籍</a></li>
                <li><a href="${domainUrl}/book/categoryp">分类</a></li>
                <li><a href="${domainUrl}/about">关于我们</a></li>
                <c:if test="${user1==null }">
                    <li><a href="${domainUrl}/toLogin">登录</a></li>
                    <li><a href="${domainUrl}/toRegin">注册</a></li>
                </c:if>
            </ul>
            <c:if test="${user1!=null }">
                <div style="margin-right:-250px ;float: right">
                    <span style="color:red;font-size: 14px;">
                        当前在线人数：
                        <a style="color:red;font-size: 14px;">
                        <%
                            HashSet sessions=(HashSet)application.getAttribute("sessions");
                            out.print(sessions.size());
                        %></a>
                    </span>&nbsp;&nbsp;&nbsp;
                    <span id="tips" style="color:white;font-size: 16px;">欢迎:<a>${user1.userName }</a></span>&nbsp;&nbsp;&nbsp;
                    <span id="loginOut" style="font-size: 15px;color: red;cursor:pointer"><a href="${domainUrl}/loginOut" style="text-decoration:none;">注销</a></span>
                </div>
            </c:if>

        </div>

    </div>


    <div class="center_content">
        <div class="left_content">

            <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet1.gif" alt="" title="" /></span>推荐   书籍</div>
            <div id="zhuye">

            </div>



            <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet2.gif" alt="" title="" /></span>新的   图书</div>

            <div class="new_products">

                <div class="new_prod_box">
                    <a href="details.html">product name</a>
                    <div class="new_prod_bg">
                        <span class="new_icon"><img src="${domainStaticUrl}/images/new_icon.gif" alt="" title="" /></span>
                        <a href="details.html"><img src="${domainStaticUrl}/images/thumb1.gif" alt="" title="" class="thumb" border="0" /></a>
                    </div>
                </div>

            </div>


            <div class="clear"></div>
        </div><!--end of left content----------------------------------------------------------------------------------->

        <div class="right_content">
            <div class="languages_box">
                <span class="red">语言:</span>
                <a href="#" class="selected"><img src="${domainStaticUrl}/images/gb.gif" alt="" title="" border="0" /></a>
                <a href="#"><img src="${domainStaticUrl}/images/fr.gif" alt="" title="" border="0" /></a>
                <a href="#"><img src="${domainStaticUrl}/images/de.gif" alt="" title="" border="0" /></a>
            </div>
            <div class="currency">
                <span class="red">货币: </span>
                <a href="#">DOLLAR</a>
                <a href="#" class="selected">RMB</a>
            </div>


            <div class="cart">
                <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/cart.gif" alt="" title="" /></span>My cart</div>
                <div class="home_cart_content">
                    <span id="cartNum"></span>
                    <span class="red"> 件商品 |  总计:<span id="cartCountPrice"></span> ￥</span>
                </div>
                <input id="cart" style="color:white;background: green;margin-top: 13px;cursor:pointer;border: 0px" type="button" value="购物车" />

            </div>




            <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet3.gif" alt="" title="" /></span>关于我们的书店</div>
            <div class="about">
                <p>
                    <img src="${domainStaticUrl}/images/about.gif" alt="" title="" class="right" />
                    每个人的生命中，都有最艰难的那一年，将人生变得美好而辽阔。 一个失去了一切的人，如何重新找到牵挂，书，爱情，宴会和欢笑，以及一切美好生活。
                </p>

            </div>

            <div class="right_box">

                <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet4.gif" alt="" title="" /></span>促销</div>
                <div id="endBook">

                </div>
            </div>

            <div class="right_box">

                <a href="jsp/specials.jsp"><div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet5.gif" alt="" title="" /></span>分类</div></a>

                <ul class="list">
                    <li><a href="#">政治</a></li>
                    <li><a href="#">经济</a></li>
                    <li><a href="#">历史</a></li>
                    <li><a href="#">科学</a></li>
                    <li><a href="#">文学</a></li>
                    <li><a href="#">体育</a></li>
                </ul>

                <div class="title"><span class="title_icon"><img src="${domainStaticUrl}/images/bullet6.gif" alt="" title="" /></span>合作伙伴</div>

                <ul class="list">
                    <li><a href="#">宇宙 </a></li>
                    <li><a href="#">星系</a></li>
                    <li><a href="#">银河</a></li>
                    <li><a href="#">太阳</a></li>
                    <li><a href="#">地球</a></li>
                    <li><a href="#">月亮</a></li>
                    <li><a href="#">星星</a></li>
                    <li><a href="#">海洋</a></li>
                    <li><a href="#">陆地</a></li>
                </ul>

            </div>


        </div><!--end of right content--------------------------------------------------------------------------------------------->




        <div class="clear"></div>
    </div><!--end of center content-->


    <div class="footer">
        <div class="left_footer">
            <img src="${domainStaticUrl}/images/footer_logo.gif" alt="" title="" /><br />

        </div>
        <div class="right_footer">
            <a href="jsp/index.jsp">主页</a>
            <a href="jsp/about.jsp">关于我们</a>
            <a href="jsp/category.jsp">书籍</a>
            <a href="jsp/specials.jsp">特别的书</a>
        </div>


    </div>


</div>

</body>
<script type="text/javascript" src="${domainStaticUrl}/js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="${domainStaticUrl}/js/index.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        var user1='<%=session.getAttribute("user1")%>';
        if("null"!=user1){
            var cartNum=$("#cartNum");
            var cartCountPrice=$("#cartCountPrice");
            $.post("cart/cart",{},function(r){
                var obj=eval("("+r+")");
                var cartString=obj.cartString;
                var cartNum2=obj.cartNum;
                var cartCountPrice2=obj.cartCountPrice;
                cartNum.html(cartNum2);
                cartCountPrice.html(cartCountPrice2);

            })
        }
    });
    $("#cart").click(function(){
        $.post("cart/cart",{},function(r){
            var obj=eval("("+r+")");
            var cartString=obj.cartString;
            if(cartString=="未登录,请先登录!"){
                alert(cartString);
                location.href="${domainUrl}/toLogin";
            }else{
                location.href="${domainUrl}/cart/lookCart"
            }
        })
    })
</script>
</html>
